$OpenBSD: patch-ssplit_c,v 1.3 2010/05/24 22:17:03 espie Exp $
--- ssplit.c.orig	Sat Oct 31 04:58:47 1998
+++ ssplit.c	Sat May 22 16:47:48 2010
@@ -18,6 +18,7 @@ char *ssplit_rcs = "$Id: ssplit.c,v 1.6 1998/10/27 16:
  *      l = flag indicating whether to ignore leading field separators
  */
 
+#include <stdio.h>
 #include <string.h>
 
 int ssplit(char *s, char *c, char *v[], int n, int m, int l)
@@ -58,7 +59,10 @@ int ssplit(char *s, char *c, char *v[], int n, int m, 
 
     xsize = 256;
 
-    x = (char **) zalloc((xsize) * sizeof(char *));
+    if((x = (char **) zalloc((xsize) * sizeof(char *))) == NULL) {
+       fprintf(stderr, "%s:%d zalloc failed\n", __FILE__, __LINE__);
+       exit(-1);
+    }
 
     x[xi++] = (char *) p;	/* first pointer is the beginning of string */
 
@@ -73,6 +77,10 @@ int ssplit(char *s, char *c, char *v[], int n, int m, 
 			char **new_x = (char **)
 				zalloc((new_xsize) * sizeof(char *));
 
+		        if(new_x == NULL) {
+			   fprintf(stderr, "%s:%d zalloc failed\n", __FILE__, __LINE__);
+			   exit(-1);
+			}
 			for(i=0; i < xsize; i++) new_x[i] = x[i];
 
 			free(x);
